﻿<div class="form-horizontal" ms-controller="CCXJADD">
    <div class="form-group">
        <label class="col-xs-2 control-label">表单申请人</label>
        <div class="col-xs-4">
            <p class="form-control-static" ms-text="modelData.ShenQingRen"></p>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><span class="Required">*</span>申请类型</label>
        <div class="col-xs-5">
            <select name="conType" id="conType" ms-duplex="modelData.LeiBie" class="form-control">
                <option ms-repeat-item="ColumnData" ms-attr-value="item.TypeNO" ms-attr-selected="item.TypeNO==modelData.LeiBie?'selected':''">{{item.TypeNO}}</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><span class="Required">*</span>起止时间</label>
        <div class="col-xs-3">
            <input id="conNR" ms-duplex="modelData.StarTime" class="szhl_form_date_time form-control szhl_require" />
        </div>
        <div class="col-xs-3">
            <input type="text" ms-duplex="modelData.EndTime" class="szhl_form_date_time form-control szhl_require" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><span class="Required">*</span>请假天数</label>
        <div class="col-xs-5">
            <input type="text" ms-duplex="modelData.Daycount" class="form-control szhl_require" />
        </div>
    </div>


    <div class="form-group hide">
        <label class="col-xs-2 control-label"><span class="Required">*</span>审核人</label>
        <div class="col-xs-5">
            <select class="form-control">
                <option ms-repeat-item="SPUserData" ms-attr-value="item.UserName" ms-attr-selected="item.UserName==modelData.SPUser?'selected':''">{{item.UserRealName}}</option>
            </select>
        </div>
    </div>
   
    <div class="form-group">
        <label class="col-xs-2 control-label">事由</label>
        <div class="col-xs-9">
            <textarea type="text" ms-duplex="modelData.ZhuYaoShiYou" rows="4" class="span2   form-control szhl_require"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">抄送人</label>
        <div class="col-xs-9">
            <input type="text" ms-duplex="modelData.ChaoSongRen" class="form-control szhl_getPeoples" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">附件</label>
        <div class="col-xs-9">
            <input type="text" ms-duplex="modelData.Files" class="span2  szhl_Upload form-control" />
        </div>
    </div>
</div>
<script>
    var strId = ComFunJS.getQueryString("ID");
    var model = avalon.define({
        $id: "CCXJADD",
        ColumnData: [],
        SPUserData: [],
        modelData: { "ShenQingRen": ComFunJS.convertuser(ComFunJS.getCookie('username')), "StarTime": "", "EndTime": "", "Daycount": "1", "LeiBie": "", "SPUser": "", "ChaoSongRen": "", "ZhuYaoShiYou": "", "Files": "" }
    });
    function getdata() {
        var modelValue = JSON.stringify(model.modelData.$model);
        return { Action: "ADDCCQJ", P1: modelValue };
    }
    function getSPdata(reason, status) {
        return { Action: "SPCCQJ", P1: strId, P2: reason, spstatus: status };
    }
    avalon.ready(function () {
        //获取请假类型
        $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 3 }, function (resultData) {
            if (resultData.ErrorMsg == "") {
                model.ColumnData = resultData.Result;
                if (strId == null) {
                    model.modelData.LeiBie = resultData.Result[0].TypeNO;
                }
            }
        })
        //获取审批人员
        $.getJSON('/API/FTAPI.ashx?Action=GETSPUSERLIST', { P1: "请假出差" }, function (resultData) {
            if (resultData.ErrorMsg == "") {
                model.SPUserData = resultData.Result;
                //if (strId == null) {
                //    CCXJ.modelData.SPUser = resultData.Result[0].UserName;
                //}
            }
        })
        if (strId != null) { 
            //编辑加载数据
            $.getJSON('/API/FTAPI.ashx?Action=GETCCQJMODEL', { P1: strId }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.modelData = resultData.Result;
                }
            })
        }
    })
    $(function () {
        if (strId == null) {
            $(".btnSucc").text("送审");
        }
    })
</script>
